/*
 * @Author: pengtianrui 2276608413@qq.com
 * @Date: 2024-08-22 17:23:57
 * @LastEditors: wanghuan wanghuan@sgsimulation.com
 * @LastEditTime: 2024-09-02 15:14:16
 * @FilePath: \SGFEM\DataStructure\FEM\Node\src\NodeData.cpp
 */
#include "DataStructure/Input/Node/NodeData.h"

#include "DataStructure/Common/Validation.h"
#include "DataStructure/Input/Solver/DOFDirections.h"

using SG::DataStructure::FEM::NodeData;

SG::DataStructure::FEM::DofSet NodeData::GetConstraint () const
{
    if (0 == m_ps)
    {
        return {};
    }

    return Int2VDofSet (m_ps);
}

bool SG::DataStructure::FEM::operator== (const NodeData& a, const NodeData& b)
{
    if (!SG::DataStructure::Common::isNear (a.m_x[0], b.m_x[0]))
    {
        return false;
    }
    if (!SG::DataStructure::Common::isNear (a.m_x[1], b.m_x[1]))
    {
        return false;
    }
    if (!SG::DataStructure::Common::isNear (a.m_x[2], b.m_x[2]))
    {
        return false;
    }

    if (a.m_defCoord != b.m_defCoord)
    {
        return false;
    }
    if (a.m_dispCoord != b.m_dispCoord)
    {
        return false;
    }

    if (a.m_ps != b.m_ps)
    {
        return false;
    }
    if (a.m_seid != b.m_seid)
    {
        return false;
    }

    if (a.m_dominId != b.m_dominId)
    {
        return false;
    }

    return true;
}